var dbConfig = require('../util/dbconfig.js');

// 获取分类列表
getCate = (req, res) => {
	var sql = 'select * from temp_cate';
	var sqlArr = [];
	var callBack = (err, data) => {
		if (err) {
			console.log('连接出错！');
		} else {
			res.send({
				'data': data
			})
		}
	}
	dbConfig.sqlConnect(sql, sqlArr, callBack)
};

// 根据id查询列表
getWorldList = (req, res) => {
	let {
		id
	} = req.query;
	var sql = 'select * from temp_world where cate_id=?';
	var sqlArr = [id];
	var callBack = (err, data) => {
		if (err) {
			console.log('连接出错！');
		} else {
			res.send({
				'data': data
			})
		}
	}
	dbConfig.sqlConnect(sql, sqlArr, callBack)
}

module.exports = {
	getCate,
	getWorldList
};